home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / dsp / 56200tar.z / 56200tar / 56200 / p2 < prev    next >
Text File  |  1992-04-28  |  11KB  |  193 lines

  1.  
  2.  
  3.          /***********************************************\
  4.          |**                                           **|
  5.          |**   DSP56200 CHIP DRIVER -ADAPTIVE FILTER   **|
  6.          |**                        -INTERRUPT DRIVEN  **|
  7.          |**                                           **|
  8.          \***********************************************/
  9.  
  10.  
  11.  
  12. /************************************************************************\
  13. *                                                                        *
  14. *   This file contains a flowchart of the host processor program used    *
  15. *   to setup and service the DSP56200 as a real-time adaptive filter.    *
  16. *   In this example, the host processor is interrupted at the beginning  *
  17. *   of every new sample period, signified by the reception of a rising   *
  18. *   edge on the DSP56200's START pin.  The host processor's interrupt    *
  19. *   pin is tied to the START pin of the DSP56200 through an inverter.    *
  20. *                                                                        *
  21. *                                                                        *
  22. *   The example system is configured as shown below:                     *
  23. *                                                                        *
  24. *                                                                        *
  25. *                               ------------                             *
  26. *                               | DSP56200 |                             *
  27. *                               ------------                             *
  28. *                                     ^                                  *
  29. *                                     |                                  *
  30. *                                     v                                  *
  31. *                  -------    ------------------                         *
  32. *          d(t) -->| A/D |--->| Host Processor |                         *
  33. *                  -------    |                |    -------              *
  34. *                             | (contains code |--->| D/A |--> out(t)    *
  35. *                  -------    |  found in this |    -------              *
  36. *         x1(t) -->| A/D |--->|     file)      |                         *
  37. *                  -------    ------------------                         *
  38. *                                                                        *
  39. *                                                                        *
  40. *                    Figure 1. Adaptive Filtering System                 *
  41. *                                                                        *
  42. *                                                                        *
  43. *                                                                        *
  44. *   There is only one DSP56200 in this example (i.e., not multiple       *
  45. *   DSP56200s in cascade), and it is configured as an adaptive filter    *
  46. *   (see Figure 2) by writing the DSP56200's Configuration register.     *
  47. *   Since only 16 bits of the result  are sent to the D/A Converter,     *
  48. *   the output is rounded to a 16 bit result by the DSP56200.            * 
  49. *                                                                        *
  50. *                                                                        *
  51. *                                                                        *
  52. *                                                                        *
  53. *         d(n) -------------------------------                           *
  54. *                                          - |                           *
  55. *                                            v                           *
  56. *                    --------------     +   ---                          *
  57. *        x1(n) ----->|    FIR     |------->| + |-----> out(n)            *
  58. *                    |  Structure |         ---           = -1 * error   *
  59. *                    --------------          |                           *
  60. *                          ^                 |                           *
  61. *                          |                 |                           *
  62. *                          -------------------                           *
  63. *                                                                        *
  64. *                                                                        *
  65. *                   Figure 2. DSP56200 Configuration                     *
  66. *                                                                        *
  67. *                                                                        *
  68. \************************************************************************/
  69.  
  70.  
  71.  
  72. Flowchart #1: Adaptive Filter Mode, Single Chip - Interrupt Driven
  73.  
  74.    Main Program:
  75.  
  76.  
  77.  
  78.                              -----------
  79.                              |  Begin  |
  80.                              -----------
  81.                                   |
  82.                      -----------------------------
  83.                      |  Disable START Interrupt  |
  84.                      -----------------------------
  85.                                   |
  86.                      -----------------------------
  87.                      | Set-up Global Variables:  |
  88.                      |       passnum = 3         |
  89.                      |       tap     = 0         |
  90.                      -----------------------------
  91.                                   |
  92.                       ----------------------------
  93.                       |  Enable START Interrupt  |
  94.                       ----------------------------
  95.                                   |
  96.                -----------------------------------------
  97.                | Perform Other Tasks or Idle:          |
  98.                |    At this time, the host can perform |
  99.                |    some other task.  Upon receiving   |
  100.                |    a START interrupt, the interrupt   |
  101.                |    service routine is then called.    |
  102.                -----------------------------------------
  103.  
  104.  
  105.  
  106.    Interrupt Service Routine:
  107.  
  108.  
  109.  
  110.               -----------
  111.               |  Begin  |
  112.               -----------
  113.                    |
  114.       ---------------------------
  115.       |  Save Processor Status  |
  116.       ---------------------------
  117.                    |
  118.             --------------                --------------           
  119.           /  passnum = 3 ? \____________/  passnum = 2 ? \____________ 
  120.           \                / No         \                / No         |
  121.             --------------                --------------              |
  122.                    | Yes                         | Yes                |
  123.         -------------------------         ----------------            |
  124.         | Write Bank 1 Regs:    |         |  tap = tap+1 |            |
  125.         |    CONFIG  = 99 (hex) |         ----------------            |
  126.         |    FTL     = ff (hex) |                |                    |
  127.         |    LEAKAGE = 00 (hex) |          -------------              |
  128.         -------------------------          |   Write   |              |
  129.                    |                       | COEFF = 0 |              |
  130.         ------------------------           -------------              |
  131.         | Switch to Bank 0:    |                 |                    |
  132.         |    CONFIG = 98 (hex) |             ---------                |
  133.         ------------------------           /    tap    \_____         |
  134.                    |                       \  = FTL ?  / No  |        |
  135.         ------------------------             ---------       |        |
  136.         | Write Bank 0 Regs:   |                 | Yes       |        V
  137.         |    K    = 0400 (hex) |                 |           |        |
  138.         |    X1     = 0        |          ----------------   |        |
  139.         |    D      = 0        |          | passnum =    |   |        |
  140.         |    COEFF  = 0        |          |    passnum-1 |   |        |
  141.         |    RAMADR = 0        |          ----------------   |        |
  142.         ------------------------                 |           |        |
  143.                    |                             |           |        |
  144.            ----------------                      |           |        |
  145.            | passnum =    |                      +<----------         |
  146.            |    passnum-1 |                      |                    |
  147.            ----------------                      |                    |
  148.                    |                             |                    |
  149.         -----------+<----------------------------                     |
  150.        |                                                              |
  151.        |                                                              |
  152.        |                                                    ----------
  153.        |                                                   |
  154.        |                                                   |
  155.        |                                            --------------  
  156.        |                     _____________________/  passnum = 1 ? \
  157.        |                    |                  No \                /
  158.        |                    |                       --------------  
  159.        |                    |                              | Yes    
  160.        |          ---------------------         ------------------------
  161.        |          | Get 2 New Samples |         | Enable Updates:      |
  162.        |          |   From the A/Ds   |         |    CONFIG = 90 (hex) |
  163.        |          ---------------------         ------------------------
  164.        |                    |                              |
  165.        |      -----------------------------         ----------------
  166.        V      |   Write the New Samples   |         | passnum =    |
  167.        |      | to the X1 and D Registers |         |    passnum-1 |
  168.        |      -----------------------------         ----------------
  169.        |                    |                              |
  170.        |       ----------------------------                |
  171.        |       |   Read the Error Term    |                |
  172.        |       | From the OUTPUT Register |                |
  173.        |       ----------------------------                |
  174.        |                    |                              V
  175.        |          -----------------------                  |
  176.        |          | Send the Error Term |                  |
  177.        |          |     to the D/A      |                  |
  178.        |          -----------------------                  |
  179.        |                    |                              |
  180.         ------------------->+<-----------------------------
  181.                             |
  182.                             |
  183.               ------------------------------
  184.               |  Restore Processor Status  |
  185.               ------------------------------
  186.                             |
  187.               ------------------------------
  188.               |  Return to Calling Program |
  189.               ------------------------------
  190.  
  191.  
  192.  
  193.